var mysql = require('mysql');
var conn = mysql.createConnection({
	host: 'localhost',
	port: 3306,
	user: 'root',
	password: 'root',
	database: 'test',	multipleStatements: true
});

conn.connect();


var queues=require('mysql-queues');
queues(conn, false);

var trans = conn.startTransaction();
trans.query("UPDATE user SET name = ? WHERE id = ?", ["张一", 1], function(err, info) {
	if (err) {
		throw err;
		trans.rollback();
	} else {
		trans.commit(function(err, info) {
			console.log(info);
		});
	}
	conn.end();
});
trans.execute();


